home *** CD-ROM | disk | FTP | other *** search
/ CD Concept 6 / CD Concept 06.iso / mac / UTILITAIRE / RLaB / testmatrix / prolate.r < prev    next >
Text File  |  1994-12-20  |  1KB  |  44 lines

  1. //-------------------------------------------------------------------//
  2.  
  3. // Synopsis:    Prolate matrix - symmetric, ill-conditioned 
  4. //              Toeplitz matrix.
  5.  
  6. // Syntax:      A = prolate ( N , W )
  7.  
  8. // Description:
  9.  
  10. //      A is the N-by-N prolate matrix with parameter W.
  11. //      It is a symmetric Toeplitz matrix.
  12. //      If 0 < W < 0.5 then
  13. //         - A is positive definite
  14. //         - the eigenvalues of A are distinct, lie in (0, 1), and
  15. //           tend to cluster around 0 and 1.
  16. //      W defaults to 0.25.
  17.  
  18. //      Reference:
  19. //       J.M. Varah. The Prolate matrix. Linear Algebra and Appl.,
  20. //       187:269--278, 1993.
  21.  
  22. //    This file is a translation of prolate.m from version 2.0 of
  23. //    "The Test Matrix Toolbox for Matlab", described in Numerical
  24. //    Analysis Report No. 237, December 1993, by N. J. Higham.
  25.  
  26. // Dependencies
  27.    require toeplitz
  28.  
  29. //-------------------------------------------------------------------//
  30.  
  31. prolate = function ( n , w )
  32. {
  33.   local (n, w)
  34.   global (pi)
  35.  
  36.   if (!exist (w)) { w = 0.25; }
  37.  
  38.   a = zeros (n, 1);
  39.   a[1] = 2*w;
  40.   a[2:n] = sin( 2*pi*w*(1:n-1) ) ./ ( pi*(1:n-1) );
  41.  
  42.   return toeplitz(a);
  43. };
  44.